package cn.itcast.springMVC.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.springMVC.domain.Category;
import cn.itcast.springMVC.mapper.CategoryMapper;

@Service
@Transactional
public class CategoryService{
	
	@Autowired
	CategoryMapper mapper;
	
	public void foo() {
		System.out.println("foo..");
	}
	
	//查询所有的分类
	public List<Category> findByAll() {
		
		List<Category> findByAll = mapper.findByAll();
		
		return findByAll;
	}
	
	//添加分类
	public void insertCategory(Category category) {
		
		mapper.insertCategory(category);
		
	}

	public void updateCategory(Category category) {
		
		mapper.updateCategory(category);
		
	}

	public void deleteCategory(Integer id) {
		
		mapper.deleteCategory(id);
		
	}
}
